package sdau.hjk.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sdau.hjk.entity.ManagerNotice;
import sdau.hjk.service.Impl.ManagerNoticeService;

import java.text.ParseException;
import java.util.List;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−03-29 16:08
 *@className:sdau.hjk.controller.ManagerNoticeController
 *@description: TODO
 */
@Controller
@RequestMapping("/managerNotice")
public class ManagerNoticeController {
    @Autowired
    private ManagerNoticeService managerNoticeService;

    //显示所有公告
    @RequestMapping("/findAll")
    @ResponseBody
    public List<ManagerNotice> findAll(){
        return managerNoticeService.findAll();
    }

    //根据id查询公告
    @RequestMapping("/findById")
    @ResponseBody
    public ManagerNotice findById(Integer id){
        return managerNoticeService.findById(id);
    }

    //发布公告
    @RequestMapping("/save")
    public void save(ManagerNotice managerNotice) throws ParseException {
        managerNoticeService.saveManagerNotice(managerNotice);
    }
}
